<template>
  <div class="search">
    <p>{{ iptObj.title }}</p>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item :label="iptObj.userTitle" v-show="iptObj.userBool">
        <el-input v-model="formInline.user" :placeholder="iptObj.userText" />
      </el-form-item>

      <el-form-item :label="iptObj.userTel" v-show="iptObj.telrBool">
        <el-input v-model="formInline.tel" :placeholder="iptObj.telText" />
      </el-form-item>

      <el-form-item :label="iptObj.userRegion" v-show="iptObj.regionBool">
        <el-select v-model="formInline.region" :placeholder="iptObj.regionText">
          <el-option
            :label="item"
            :value="item"
            v-for="(item, index) in optionArr"
            :key="item"
          />
        </el-select>
      </el-form-item>

      <el-form-item v-show="BtnBool">
        <el-button type="primary" @click="$emit('onSubmit', formInline)"
          >搜索</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { reactive, ref } from "vue";

const formInline = reactive({
  user: "",
  tel: "",
  region: a.region ? a.optionArr[0] : "",
});

const a = defineProps({
  // 整个设置
  iptObj: {
    default: {
      title: "标题",
      userBool: true, //手机搜索框是否显示
      userTitle: "订单编号",
      userTel: "联系电话",
      userRegion: "当前状态",
      telrBool: true, //电话搜索框是否显示
      regionBool: true, //选项框是否显示
      userText: "请输入订单编号",
      telText: "请输入联系电话",
      regionText: "请选择内容",
    },
  },
  // 选项显示的数据
  optionArr: {
    default: [1, 2, 3],
  },
  // 选项显示提示还是数组第一个数据
  region: {
    default: false,
  },
  BtnBool: {
    default:true
  },

});

defineEmits(["onSubmit"]);
</script>

<style lang="less" scoped>
.search {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  // background: yellow;
  box-sizing: border-box;
  font-size: 20px;
  font-weight: 700;
  padding-left: 20px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  // background: yellow;
  box-sizing: border-box;
  font-size: 20px;
  // font-weight: 700;
  padding-left: 20px;

  .demo-form-inline {
    padding-top: 20px;
    // margin-left: 20px;
  }
}
</style>
